#ifndef QUERYPATIENTUI_H
#define QUERYPATIENTUI_H

#include <QWidget>
#include "BaseWidget.h"
#include "WidgetId.h"
#include "AppLog.h"
#include "PatientRecordItem.h"
#include "MedicalInfo.h"
#include <QButtonGroup>
#define PATIENT_RECORD_SIZE (10)

namespace Ui {
class QueryPatientUi;
}

class QueryPatientUi : public BaseWidget
{
    Q_OBJECT

public:
    explicit QueryPatientUi(QWidget *parent = nullptr);
    ~QueryPatientUi()override;
    void activate()override;
    void inactivate()override;

protected:
    void changeEvent(QEvent* e)override;

private slots:
    void on_gohome_clicked();
    void on_goback_clicked();
    void clickedSlot(int index);

    void on_query_clicked();

    void on_queryPatient_3_clicked();

    void on_queryPatient_2_clicked();

private:
    Ui::QueryPatientUi *ui;
    PatientRecordItem* g_infoArray[10];
    QVector<PatientInfo *> m_list;
    QButtonGroup m_buttongroup;
    QString m_querytype;
    QString m_querystr;
    int m_pages = 0;
    int m_currentPageIndex = 0;
    void clearPatientRecord();
    int queryAllPatientInfo();
    void updatePatientList();
    void clearList();
    int queryOnePatientByNumber(int number);
};

#endif // QUERYPATIENTUI_H
